package com.ruyuan.dependency.product.service.impl;

import com.ruyuan.dependency.product.entity.Brand;
import com.ruyuan.dependency.product.mapper.BrandMapper;
import com.ruyuan.dependency.product.service.BrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @author zhonghuashishan
 */
@Service
public class BrandServiceImpl implements BrandService {

    @Autowired
    private BrandMapper brandMapper;

    @Override
    public Brand queryById(Long brandId) {
        return brandMapper.selectById(brandId);
    }

    @Override
    public void save(Brand brand) {
        brand.setCreateTime(new Date());
        brand.setUpdateTime(brand.getCreateTime());
        brandMapper.insert(brand);
    }
}